<template xmlns="http://www.w3.org/1999/html">
  <sea-data-table ref="tableObject" url="/api/mapping/page">
    <!--表头-->
    <sea-table-header slot="header" disabled-form>
      <!--标题栏-->
      <sea-table-title slot="title" title="系统接口分组"
                      subtitle="包含所有 Controller 的信息"></sea-table-title>

    </sea-table-header>

    <!--表头-->
    <template slot="columns">
      <sea-col-link property="controllerClass" label="归属类" width="360" :click="onAction"></sea-col-link>
      <el-table-column property="methodName" label="方法名" width="360" :click="onAction"></el-table-column>
      <el-table-column property="requestMapping" label="请求路径" width="260"></el-table-column>
      <el-table-column property="description" label="描述" show-overflow-tooltip></el-table-column>
    </template>

    <!-- 弹窗、抽屉 -->
    <template slot="drawer">
      <sea-dialog ref="dialog">
        <parameter ref="parameter" :object="row_data"></parameter>
      </sea-dialog>
    </template>
  </sea-data-table>
</template>

<script>
import Parameter from "./parameter";

/**
 *
 * 系统访问日志
 */
export default {
    components: {Parameter},
    data() {
        return {
            // 操作名称
            operation: undefined
            // 当前操作的行级对象
            , row_data: undefined
            // end--
        }
    },
    methods: {
        /**
         * 操作栏事件分发
         * @param evt 事件
         * @param row 行级对象
         * @param old 可供回滚的参数
         */
        onAction: function (evt, row, old) {
            this.operation = evt;
            if (evt === '$controllerClass') {
                let dialog = {title: row.description, fullscreen: true};
                this.$refs.dialog.open(dialog).then(() => {
                    this.$refs.parameter.setRowData(row);
                });
            }
        }
    }
}
</script>
